#ifndef _SKYPECOMMWINDOW_H_
#define _SKYPECOMMWINDOW_H_
//
#include <windows.h>
#include "../../Utils/Queue.h"
#include "../../Utils/List.h"
#include "../../Utils/String.h"
//
class SkypeCommWindow {
public:
	enum ConnResult {
		OK, CantConnectToSkype, TimedOut
	};
	SkypeCommWindow();
	ConnResult connectToSkype(int connTimeoutInSeconds);
	void sendCommand(const TCHAR* cmd);
	~SkypeCommWindow();
	List<tstring>& getRawResponse();
private:
	static const TCHAR CLASS_NAME[];
	static const TCHAR SKYPE_DISCOVER[];
	static const TCHAR SKYPE_ATTACH[];
	Queue<MSG> _wndMsgQueue;
	Queue<TCHAR*> _skypeInternalMsgQueue;
	List<tstring> _skypeMsgList;
	HWND _hWnd;
	HWND _skypeWnd;
	UINT _wmSkypeDiscover;
	UINT _wmSkypeAttach;
	Event _windowCreated;
	Event _evWindowDestroyed;
	bool _processWindow();
	ConnResult _processSkypeResponses(unsigned int timeout);
	bool _processConnect(const MSG& msg, SkypeCommWindow::ConnResult& result);
	static void __cdecl _thrWndProcess(void* arg);
	static void __cdecl _thrProcessSkypeResponses(void* arg);
	static LRESULT CALLBACK _wndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
};
//
#endif
